/*
 * Created on Wed May 23 2018
 * Author: Hu Fei
 * Email: feige_hu@foxmail.com
 *
 * Copyright (c) 2018 HF
 */
const EventEmitter = require('events')
class Store extends EventEmitter {
  constructor(opts) {
    super()
    this.opts = opts || {}
    this._data = []
    this._total = 0
    this.on('loaded', ({ total, data }) => {
      this._total = total
      this._data = data
    })
  }
  read() {
    console.warn('Please override this function !!!!')
    return new Promise()
  }
  get length() {
    return this._data.length
  }
  get total() {
    return this._total
  }
  get data() {
    return this._data
  }
}

export default Store
